public class Test_Opportunity_Household_Soft_Credits {
	static testMethod void testCloneOpp(){
		//create a contact
		Contact firstContact = new Contact (
			FirstName='Joe',
			LastName='Johanssen',
			MailingStreet='123 Elm St',
			MailingCity='Wauwatosa',
			MailingState='WI',
			MailingPostalCode='53213',
			MailingCountry='USA'			
		);
		insert firstContact;
		
		Contact[] firstHouseholdMember = [select id,ONEN_Household__c from Contact where Id =:firstContact.id];
		
		Contact secondContact = new Contact (
			FirstName='Steve',
			LastName='Tester',
			ONEN_Household__c=firstHouseholdMember[0].ONEN_Household__c
					
		);
		insert secondContact;
		String primaryContactRole = 'Individual Donor';
		//create a gift
		Opportunity opp1 = new Opportunity (
			Name='Joe Johanssen 2005 Gift',
			CloseDate=Date.newInstance(2005,10,10),
			StageName='Closed Won',
			Amount=100,
			CR_Contact_Id__c=firstContact.id,
			CR_Contact_Role__c=primaryContactRole,
			CR_HHRoles__c=true
			
		);
		insert opp1;	
		
		
		Opportunity[] CreatedOpp = [select Name, StageName, CloseDate from Opportunity where Id =:opp1.Id];
		//new opp should be created with correct name
		System.assertEquals('Joe Johanssen 2005 Gift',CreatedOpp[0].Name);
		
		
		//MP: test contact role. 1. correct contact 2. correct role of correct contact
		OpportunityContactRole[] ContactRoles = [select ContactId, Contact.FirstName, Contact.LastName, Role, IsPrimary from OpportunityContactRole where OpportunityId = :opp1.Id order by Contact.LastName];
		System.assertEquals(2, ContactRoles.size());
		//make sure primary role is set right
		System.assertEquals(primaryContactRole, ContactRoles[0].Role);	
		//make sure secondary role is set right
		System.assertEquals(OppContactRoles.GetHouseholdSoftCreditRole(), ContactRoles[1].Role);
		
		String primaryContactRoleBusiness = 'Decision Maker';
		
		Opportunity opp2 = new Opportunity (
			Name='Joe Johanssen 2005 Gift',
			CloseDate=Date.newInstance(2005,10,10),
			StageName='Closed Won',
			Amount=100,
			CR_Contact_Id__c=firstContact.id,
			CR_Contact_Role__c=primaryContactRoleBusiness,
			CR_HHRoles__c=false
			
		);
		insert opp2;
		
		OpportunityContactRole[] ContactRolesbusiness = [select Id from OpportunityContactRole where OpportunityId = :opp2.Id];
		System.assertEquals(1, ContactRolesbusiness.size());

	}
}